package com.nbaplayer.info;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class BioAdapter extends BaseAdapter{
	
	Context context;
	
	String[][] bio;
	
	int position;
	
	public BioAdapter( Context context, String bio[][], int position ){
		this.context = context;
		this.bio = new String[bio.length][];
		this.bio = bio;
		this.position = position;
	}

	@Override
	public int getCount() {
		return bio.length;
	}

	@Override
	public Object getItem(int position) {
		return bio[position];
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		Bio player_bio;
		LayoutInflater layoutinflater= ((Activity)context).getLayoutInflater();
		
		if(convertView==null)  
		{  
			player_bio = new Bio();  
			convertView = layoutinflater.inflate( R.layout.player_bio, null );
			player_bio.background = (TextView) convertView.findViewById( R.id.background );
			player_bio.personal = (TextView) convertView.findViewById( R.id.personal );
			convertView.setTag(player_bio);
		}  
		else
			player_bio=(Bio)convertView.getTag();

		player_bio.background.setText( this.bio[this.position][0] );
		player_bio.personal.setText( this.bio[this.position][1] );
		
		return convertView;

	}

}
